﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BackMusic : MonoBehaviour
{
    public static BackMusic instance;

    public static BackMusic Instance
    {
        get
        {
            return instance;
        }
    }

    private AudioSource backMusic;
    private void Awake()
    {
        instance = this;
        backMusic = this.GetComponent<AudioSource>();
    }

    private void Start()
    {
        GameDataMgr.Instance.LoadMusicConf();
    }

    public void ChangeVolume(float value)
    {
        backMusic.volume = value;
    }

    public void ChangeEnable(bool enable)
    {
        //如果开启 就是不静音
        //没有开启 就是静音
        backMusic.mute = !enable;
    }

    public void Stop()
    {
        backMusic.Stop();
    }

    public void Play()
    {
        backMusic.Play();
    }
}
